<?php

use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use \kartik\builder\TabularForm;
/**
 * @var yii\web\View $this
 * @var common\models\Article $model
 * @var yii\widgets\ActiveForm $form
 */
?>

<div class="article-form">

    <?php $form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL]); echo Form::widget([

        'model' => $model,
        'form' => $form,
        'columns' => 1,
        'attributes' => [

            'title' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Title...', 'maxlength' => 512]],

            'body' => ['type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Enter Body...','rows' => 6]],

            'category_id' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Category...']],

            'slug' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Slug...', 'maxlength' => 255]],

            'published_at' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::class,'options' => ['type' => DateControl::FORMAT_DATETIME]],

            'status' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Published...']],

            'thumbnail_base_url' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter thumbnail_base_url...', 'maxlength' => 1024]],

            'thumbnail_path' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter thumbnail_path...', 'maxlength' => 1024]],

            'view' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Article View...', 'maxlength' => 255]],

            'attachments' => ['type' => TabularForm::INPUT_TEXT, 'options' => ['placeholder' => 'Enter attachments...']],

            'thumbnail' => ['type' => TabularForm::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Thumbnail...']],

        ]

    ]);

    echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'),
        ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']
    );
    ActiveForm::end(); ?>

</div>
